package com.ymatou.iapi.productmanager.testcase;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ymatou.iapi.liveseller.parameter.CreateSellerLiveBean;
import com.ymatou.iapi.prodstock.parameter.UpdateProductActivityStockTimeBean;
import com.ymatou.iapi.productmanager.parameter.ProductInListDtoBeanV2;
import com.ymatou.iapi.productmanager.parameter.QuerySellerProductBean;
import com.ymatou.iapi.productmanager.parameter.QuerySellerProductListResponseBean;
import com.ymatou.iapi.productmanager.parameter.TabStatus;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.parameter.product.CatalogSaveModel;
import com.ymatou.iapi.productmanager.service.QuerySellerProductListCall;
import com.ymatou.iapi.productmongosync.service.EsCall;
import com.ymatou.iapi.productquery.parameter.ApplyActivityDto;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.*;
import com.ymttest.business.service.productdata.impl.ProductFactory;
import com.ymttest.business.service.productdata.impl.ProductFromJSONBean;
import com.ymttest.database.annotation.SqlMapperFactory;
import com.ymttest.database.model.LiveRoom;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductActivityStockWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsInLiveWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.compare.AssertHelper;

import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

public class Ts_QuerySellerProductList {
	private static QuerySellerProductListCall querySellerProductListCall = new QuerySellerProductListCall();
	private static EsCall esCall = new EsCall();

	private static YmtProductsInLiveWapper ymtProductsInLiveWapper = new YmtProductsInLiveWapper();
	private static YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
	private static YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();

	private static Integer sellerId = Integer.valueOf(EnvSetup.getData("productsellerid"));
	private static String sellerName = EnvSetup.getData("productsellername");

	private static String jsonBeanFile = "com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Search.json";
	private static int globalSellerId = Integer.parseInt(EnvSetup.getData("globalSellerId"));


	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商品列表查询");
//		//SqlMapperFactory.getIntergratedProductMapper().updateProductoffSale(sellerId);
	}

	@Before
	public void caseUp() {
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(querySellerProductListCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_001() {
		Logger.start(true, "查询商品,根据ProductName");
		try {

			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			//String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			//创建mock商品
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "ModifyProduct");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			querySellerProductBean.setProductName(productName + "22");
			querySellerProductListCall.callService();
			Logger.verifyEquals(true, querySellerProductListCall.getJsonObject().get("Data").getAsJsonObject().get("ProductList").isJsonNull(), "商品名不对，应该搜不到");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_002() {
		Logger.start(true, "查询商品,根据ProductName,品牌");
		try {
			
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			String brandName = ymtProductsIWapper.selectProductByProductId(productId).get(0).getsBrand();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setBrandName(brandName);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));

			// 品牌名不对，应该搜不到
			querySellerProductBean.setBrandName("fasdf");
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.isNull("ProductList"), "品牌名不对，应该搜不到");
			//Logger.verifyEquals(true, ret.get("Data").getAsJsonObject().getJSONObject("ProductList").isJsonNull(), "品牌名不对，应该搜不到");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_002_001() {
		Logger.start(true, "查询商品,根据ProductName,品牌Id");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			int brandId = ymtProductsIWapper.selectProductByProductId(productId).get(0).getiBrandId();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setBrandId(Arrays.asList(brandId));
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			//check
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(false, ret.getJSONObject("Data").isNull("ProductList"), "品类在范围内");

			// 品牌名不对，应该搜不到
			querySellerProductBean.setBrandId(Arrays.asList(112333));
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
		//	JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "品牌Id不对，应该搜不到");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_003() {
		Logger.start(true, "查询商品,根据ProductName,库存");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
		//	ProductManagerCallServiceV2.esSync(0, productId, "2");
			ProductManagerCallServiceV3.productEsSync(productId, null, 0);
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setStockEnd(2000000);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

		//	checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(false, ret.getJSONObject("Data").isNull("ProductList"), "库存在范围，应该搜的到");

			// 库存不在范围，应该搜不到
			querySellerProductBean.setStockEnd(998);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "库存不在范围，应该搜不到");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_QuerySellerProductList_004() {
		Logger.start(true, "查询商品,根据ProductName,是否在直播中");
		try {

			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(2000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setIsInLive(false);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			
			// 正在直播，应该搜不到
			querySellerProductBean.setIsInLive(true);
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.isNull("Data"), "搜不到");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_QuerySellerProductList_005() {
		Logger.start(true, "查询商品,根据ProductName,销售价格");
		try {

			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);

			// 原价
			querySellerProductBean.setPriceType(1);
			querySellerProductBean.setPriceStart(10);
			querySellerProductBean.setPriceEnd(10);

			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));

			// 价格不在范围，应该搜不到
			querySellerProductBean.setPriceStart(401);
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.isNull("Data"), "价格不在范围，应该搜不到");

			querySellerProductBean.setPriceStart(20);
			querySellerProductBean.setPriceEnd(49);
			JSONObject ret2 = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret2.isNull("Data"), "价格不在范围，应该搜不到");


		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_006() {
		Logger.start(true, "查询商品,根据ProductName,是否是FBX");
		try {

			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setIsFbx(false);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_007() {
		Logger.start(true, "查询商品,根据ProductName,预售");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setIsPreSale(true);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			// 有预售，搜的到
//			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
//			Logger.verifyEquals(true, ret.isNull("Data"), "有预售，搜的到");
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "有预售，搜的到");
			
			// 没有预售，搜不到
			querySellerProductBean.setIsPreSale(false);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
//			querySellerProductListCall.callService();
//			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(false, ret.getJSONObject("Data").isNull("ProductList"), "没有预售，搜不到");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_008() {
		Logger.start(true, "查询商品,根据ProductName,物流方式");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setCatalogStatusList(Arrays.asList(4));
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			// 指定搜索,在范围内,搜的到
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			
			querySellerProductBean.setCatalogStatusList(Arrays.asList(5));
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "物流方式不在范围，应该搜不到");


		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_009() {
		Logger.start(true, "查询商品,根据ProductName,psp");
		try {

			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setCatalogStatusList(Arrays.asList(7));
			querySellerProductBean.setIsPspProductOnly(true);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			// 不是psp,不在范围内,搜不到
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "不是psp,不在范围内,搜不到");

			/*SqlMapperFactory.getIntergratedProductMapper().updatePspByProductId(productId, true);
			SqlMapperFactory.getIntergratedProductMapper().insertProductInfoAs4(productId, sellerId);

			//ProductManagerCallService.callMgoAndEs(0, productId, "AddProduct");
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));*/

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_010() {
		Logger.start(true, "查询商品,根据ProductName,品类");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			List<Integer> catagorysList = new ArrayList<>();
			// 品类不在范围内,搜不到
			catagorysList.add(12333333);
			querySellerProductBean.setCategoryIds(catagorysList);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();


			//JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "品类不在范围内,搜不到");


		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_011() {
		Logger.start(true, "查询商品,根据ProductName,新品");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setIsNewProduct(false);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			//不是新品  搜得到
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			// bushi新品 不在范围内
			querySellerProductBean.setIsNewProduct(true);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();

			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "不是新品,不在范围内,搜不到");
			
			//JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			/*SqlMapperFactory.getIntergratedProductMapper().updateIsNewByProductId(productId);
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			querySellerProductBean.setIsNewProduct(true);
			querySellerProductListCall.callService();*/

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_012() {
		Logger.start(true, "查询商品,根据ProductName,排序");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productName = addProdReq.getProduct().getProductName();

			List<String> productIdList = new ArrayList<>();

			for (int i = 0; i < 5; i++) {
				String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
				ProductManagerCallServiceV2.esSync(0, productId, "2");
				productIdList.add(productId);
				YMTDateUtil.waitTime(2);
			}

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);

			List<String> actProductList = new ArrayList<>();
			JSONArray prodListAry = ret.getJSONObject("Data").getJSONArray("ProductList");
			for (int i = 0; i < prodListAry.length(); i++) {
				actProductList.add(prodListAry.getJSONObject(prodListAry.length() - i - 1).getString("ProductId"));
			}

			for (int i = 0; i < 4; i++) {
				Logger.verifyEquals(productIdList.get(i), actProductList.get(i), "第" + i + "个相同");
			}

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	/**
	 * 没写完
	 */
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_013() {
		Logger.start(true, "查询商品,根据ProductName,过滤橱窗商品");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setFilterIsTop(true);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			// 商品查询
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			JSONObject ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(false, ret.getJSONObject("Data").isNull("ProductList"), "品类在范围内");
			//Logger.comment("2222222222222");
			
			// 修改为橱窗商品，所以无法查询到
			SellerProductCallService.removeAllProductInTop(sellerId);
			SellerProductCallService.newAddProductsIntoTopList(sellerId, Arrays.asList(productId), true);
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			YMTDateUtil.waitTime(3);
			//JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			 ret = new JSONObject(querySellerProductListCall.getReturnData());
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "品类不在范围内,搜不到");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_014() {
		Logger.start(true, "查询商品,根据ProductName,分页个数");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productName = addProdReq.getProduct().getProductName();

			List<String> productIdList = new ArrayList<>();

			for (int i = 0; i < 5; i++) {
				productIdList.add(ProductManagerCallServiceV3.AddSellerProduct(addProdReq));
				YMTDateUtil.waitTime(2);
			}

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setPageIndex(1);
			querySellerProductBean.setPageSize(2);

			// 第一页查询
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			// 第二页查询
			querySellerProductBean.setPageIndex(2);
			JSONObject ret2 = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);

			JSONArray prodListAry = ret.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, prodListAry.length(), "商品显示数量为2");
			
			JSONArray prodListAry2 = ret2.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, prodListAry2.length(), "商品显示数量为2");
			

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_015() {
		Logger.start(true, "查询商品,根据ProductName,Tab=0(销售中的商品,直播商品)");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			String productId = ProductFactory.getLiveProduct(sellerId, sellerName).getProductId();
			
			int liveId = Integer.parseInt(ymtProductsInLiveWapper.selectInLiveByProductId(productId).get(0).get("iActivityId").toString());

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(0);
			
			//checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));

			querySellerProductBean.setLiveId(liveId);
			querySellerProductBean.setTabType(TabStatus.InLive.getCode());
			Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).isNull("Data"), "不应该在tab:" + TabStatus.InLive);

			// 暂停直播
			SellerProductCallService.suspendSaleProductInLive(sellerId, liveId, productId);

			querySellerProductBean.setLiveId(0);
			//checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnNotSale, TabStatus.InLive));
			Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).isNull("Data"), "不应该在tab:" + TabStatus.InLive);

			querySellerProductBean.setLiveId(liveId);
			querySellerProductBean.setTabType(TabStatus.InLive.getCode());
			Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).isNull("Data"), "不应该在tab:" + TabStatus.InLive);

			// 商品上架
			querySellerProductBean.setLiveId(0);
			SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));*/
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(0);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"),"验证Code");
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	// error
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_016() {
		Logger.start(true, "查询商品,根据ProductName,Tab=0(销售中的商品,活动商品)");
		try {
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(0);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"),"验证Code");
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_017() {
		Logger.start(true, "查询商品,根据ProductName,Tab=0(销售中的商品,现货商品)");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			Map<String, Object> updateMap = MapUtil.hashMap("product->ProductName", productName);
			String productId = ProductFactory.getOnlyProduct(sellerId, sellerName, updateMap).getProductId();

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);

			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));

			// 商品下架
			SellerProductCallService.batchSetProductOffSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnNotSale, TabStatus.InLive));

			// 商品售罄
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.SaleOut, TabStatus.InLive));
*/
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(0);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			// 商品下架
			SellerProductCallService.batchSetProductOffSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnNotSale, TabStatus.InLive));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_018() {
		Logger.start(true, "查询商品,根据ProductName,Tab=4(待上架,将来活动商品,现货下架),");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			Map<String, Object> updateMap = MapUtil.hashMap("product->ProductName", productName, "product->OnSaleType", 2, "product->AutoRefresh", false);
			String productId = ProductFactory.getFutureActivityProduct(sellerId, sellerName, updateMap).getProductId();*/
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setOnSaleType(2);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);
			//更改活动时间
			String beginTime = YMTDateUtil.getBeforeOrNextDay(2, YMTDateUtil.YMDTHMS_STRING);
			String endTime = YMTDateUtil.getBeforeOrNextDay(3, YMTDateUtil.YMDTHMS_STRING);
			UpdateProductActivityStockTimeBean updateProductActivityStockTimeBean = ProdStockCallService.initUpdateProductActivityStockTimeBean(sellerId, productId, activityId, 0, Integer.valueOf(aids.get(0)), beginTime, endTime);
			ProdStockCallService.UpdateProductActivityStockTime(updateProductActivityStockTimeBean);
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			//现货下架
			SellerProductCallService.batchSetProductOffSale(productId, sellerId);
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(4);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnNotSale, TabStatus.InLive));
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			//checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
			// YMTDateUtil.waitTime(120);
			// checkInTab(sellerId,productId,querySellerProductBean,Arrays.asList(TabStatus.OnNotSale,TabStatus.InLive));

			// 现货上架
			/*SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));

			// 现货售罄
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.SaleOut, TabStatus.InLive));*/

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_019() {
		Logger.start(true, "查询商品,根据ProductName,Tab=4(待上架,已结束活动,现货下架),");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			Map<String, Object> updateMap = MapUtil.hashMap("Product->ProductName", productName, "Product->OnSaleType", 2, "Product->AutoRefresh", false);
			String productId = ProductFactory.getPreviousActivityProduct(sellerId, sellerName, updateMap).getProductId();*/
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			addpro.getProduct().setOnSaleType(2);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			//获取规格ID
			List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
			//创建一个活动  得到活动id
			Integer activityId = ProductManagerCallServiceV2.createIsolationActivityInProcess();
			//报名活动  获得商品在活动中的id
			List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, 100,"10");
			//审核通过
			ProductManagerCallServiceV2.approveProductInActivity(productId,aids.get(0),true);
			//更改活动时间
			String beginTime = YMTDateUtil.getBeforeOrNextDay(-3, YMTDateUtil.YMDTHMS_STRING);
			String endTime = YMTDateUtil.getBeforeOrNextDay(-2, YMTDateUtil.YMDTHMS_STRING);
			UpdateProductActivityStockTimeBean updateProductActivityStockTimeBean = ProdStockCallService.initUpdateProductActivityStockTimeBean(sellerId, productId, activityId, 0, Integer.valueOf(aids.get(0)), beginTime, endTime);
			ProdStockCallService.UpdateProductActivityStockTime(updateProductActivityStockTimeBean);
			// 现货下架
			SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			ProductManagerCallServiceV2.esSync(0, productId, "2");

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setTabType(4);

			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			
			// 现货售罄
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			querySellerProductListCall.callService();
			//checkInTab(sellerId,productId,querySellerProductBean,Arrays.asList(TabStatus.OnNotSale,TabStatus.InLive));

			// 现货上架
			/*SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));*/

			// 现货售罄
			/*SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.SaleOut, TabStatus.InLive));*/

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_020() {
		Logger.start(true, "查询商品,根据ProductName,Tab=4(待上架,将来直播商品,现货下架),");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			Map<String, Object> updateMap = MapUtil.hashMap("Product->ProductName", productName, "Product->OnSaleType", 2, "Product->AutoRefresh", false);
			String productId = ProductFactory.getFutureLiveProduct(sellerId, sellerName, updateMap).getProductId();
			int liveId = Integer.parseInt(ymtProductsInLiveWapper.selectInLiveByProductId(productId).get(0).get("iActivityId").toString());

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);

			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnNotSale, TabStatus.InLive));

			// 现货上架
			SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));

			// 现货售罄
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.SaleOut, TabStatus.InLive));

			// 排除该直播
			querySellerProductBean.setLiveId(liveId);
			querySellerProductBean.setTabType(TabStatus.InLive.getCode());
			Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).isNull("Data"), "不应该在tab:" + TabStatus.InLive);*/
			
			
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productName = addpro.getProduct().getProductName();
			addpro.getProduct().setOnSaleType(2);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			
			checkInTab(sellerId,productId,querySellerProductBean,Arrays.asList(TabStatus.OnNotSale,TabStatus.InLive));
			// 现货下架
			/*SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			ProductManagerCallServiceV2.esSync(0, productId, "2");
			checkInTab(sellerId,productId,querySellerProductBean,Arrays.asList(TabStatus.OnNotSale,TabStatus.InLive));*/
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_021() {
		Logger.start(true, "查询商品,根据ProductName,Tab=4(待上架,已结束直播商品,现货下架),");
		try {
			/*String productName = "测试商品" + TestDataManager.getRandomNum(10);
			Map<String, Object> updateMap = MapUtil.hashMap("product->ProductName", productName, "product->OnSaleType", 2, "product->AutoRefresh", false);
			String productId = ProductFactory.getPreviousLiveProduct(sellerId, sellerName, updateMap).getProductId();
			int liveId = Integer.parseInt(ymtProductsInLiveWapper.selectInLiveByProductId(productId).get(0).get("iActivityId").toString());*/

			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productName = addpro.getProduct().getProductName();
			addpro.getProduct().setOnSaleType(2);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Logger.comment("创建直播");
			// 5分钟后开始200分钟后结束
			CreateSellerLiveBean clive = LiveRoomCallService.initCreatesellerliveBean(sellerId);
			Date now = YMTDateUtil.getDate();
			//半小时之内会锁定不能修改
			Date starttime = new Date(now.getTime() + 60 * 60 * 1000);
			Date endtime = new Date(now.getTime() + 200 * 60 * 1000);
			clive.getLiveDto().setStartTime(YMTDateUtil.getFormatTime(starttime, YMTDateUtil.YMDHMS));
			
			LiveRoom createlive = LiveRoomCallService.CreateSellerLive(clive);
			Logger.comment("加入商品");
			LiveRoomCallService.AddProductsToLive(createlive.getId(), sellerId, productId);
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			
			checkInTab(sellerId,productId,querySellerProductBean,Arrays.asList(TabStatus.OnNotSale,TabStatus.InLive));

			// 现货上架
			/*SellerProductCallService.batchSetProductOnSale(productId, sellerId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.OnSale, TabStatus.InLive));

			// 现货售罄
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			checkInTab(sellerId, productId, querySellerProductBean, Arrays.asList(TabStatus.SaleOut, TabStatus.InLive));

			// 排除该直播
			querySellerProductBean.setLiveId(liveId);
			querySellerProductBean.setIsInLive(true);
			querySellerProductBean.setTabType(TabStatus.InLive.getCode());
			Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).isNull("Data"), "不应该在tab:" + TabStatus.InLive);*/
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_022() {
		Logger.start(true, "查询商品,根据ProductName,SortType");
		try {
			/*Pair<String, String> ProductIdAndName = getOnlyProduct();
			String productName = ProductIdAndName.getRight();
			String productId = ProductIdAndName.getLeft();

			YMTDateUtil.waitTime(3);
			Pair<String, String> ProductIdAndName2 = getOnlyProduct(productName);
			String productId2 = ProductIdAndName2.getLeft();*/
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productId2 = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);

			// 时间倒叙 setSortType -1
			YMTDateUtil.waitTime(3);
			querySellerProductBean.setSortType(0);
			querySellerProductBean.setSort(0);
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			JSONArray productList = ret.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, productList.length(), "返回productList长度");
			//Logger.verifyEquals(productId, productList.getJSONObject(0).getString("ProductId"), "返回商品Id");
			//Logger.verifyEquals(productId2, productList.getJSONObject(1).getString("ProductId"), "返回商品Id");

			// 时间正序 setSortType -1
			YMTDateUtil.waitTime(3);
			querySellerProductBean.setSortType(0);
			querySellerProductBean.setSort(1);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			productList = ret.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, productList.length(), "返回productList长度");
			Logger.verifyEquals(productId2, productList.getJSONObject(1).getString("ProductId"), "返回商品Id");
			Logger.verifyEquals(productId, productList.getJSONObject(0).getString("ProductId"), "返回商品Id");

			///////////////////////////////////////////////////////////////////////////////////////////////////
			String catalogId = ymtCatalogsIWapper.selectCatalogsByProductId(productId).get(0).getsCatalogId();
			SellerProductCallService.updateProductStockNum(sellerId, productId, catalogId, 10000);

			// 库存倒叙 setSortType >0
			YMTDateUtil.waitTime(3);
			querySellerProductBean.setSortType(1);
			querySellerProductBean.setSort(0);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			productList = ret.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, productList.length(), "返回productList长度");
			Logger.verifyEquals(productId, productList.getJSONObject(1).getString("ProductId"), "返回商品Id");
			Logger.verifyEquals(productId2, productList.getJSONObject(0).getString("ProductId"), "返回商品Id");

			// 库存正序 setSortType >0
			YMTDateUtil.waitTime(3);
			querySellerProductBean.setSortType(1);
			querySellerProductBean.setSort(1);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			productList = ret.getJSONObject("Data").getJSONArray("ProductList");
			Logger.verifyEquals(2, productList.length(), "返回productList长度");
			Logger.verifyEquals(productId, productList.getJSONObject(0).getString("ProductId"), "返回商品Id");
			Logger.verifyEquals(productId2, productList.getJSONObject(1).getString("ProductId"), "返回商品Id");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_023() {
		Logger.start(true, "查询商品,根据ProductName,PSP");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setPspStatus(1);

			// 不是psp，应该搜不到
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "不是psp，应该搜不到");

			// 设置商品为psp 待优化
			/*SqlMapperFactory.getIntergratedProductMapper().updatePspByProductId(productId, true);
			SqlMapperFactory.getIntergratedProductMapper().insertProductInfo(productId, sellerId);
			ProductManagerCallService.callMgoAndEs(0, productId, "AddProduct");

			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));

			querySellerProductBean.setPspStatus(0);
			checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));*/

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_024() {
		Logger.start(true, "查询商品,根据ProductName,非该用户无法查商品");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3123);
			querySellerProductBean.setProductName(productName);

			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"), "非该用户无法查商品");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_025() {
		Logger.start(true, "查询商品,根据ProductName,部分规格售罄露出hasSellout");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			
			String productName = addpro.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId, "2");

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setProductName(productName);
			querySellerProductBean.setHasSellOut(false);
			//商品售罄查询非售罄商品 有返回ProductList
			JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.getJSONObject("Data").isNull("ProductList"),"HasSellOut:true验证非售罄商品不露出11");
			
			//商品未售罄查询售罄商品 无返回ProductList
			querySellerProductBean.setHasSellOut(true);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			ret = new JSONObject(querySellerProductListCall.getReturnData());
			//ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(false,ret.getJSONObject("Data").isNull("ProductList"),"HasSellOut:false验证非售罄商品露出22");
			
			
			SellerProductCallService.updateAllStockNumAs0(sellerId, productId);
			YMTDateUtil.waitTime(3);
			//不选择时候 应该能搜索到商品
			querySellerProductBean.setHasSellOut(false);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true,ret.get("Data").toString().contains("ProductList"),"HasSellOut:true验证售罄商品不露出33");
			//商品售罄查询售罄商品 有返回ProductList
			querySellerProductBean.setHasSellOut(true);
			ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);
			Logger.verifyEquals(true, ret.get("Data").toString().contains("ProductList"),"HasSellOut:false验证售罄商品露出44");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_026() {
		Logger.start(true, "查询商品,TabType=20，普通商品规格库存为0，查询失败");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			ymtCatalogsIWapper.updatestocknumByProductID(0,productId);
			Thread.sleep(10000);
			ProductManagerCallServiceV2.esSync(0, productId, "ModifyProduct");
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId);
			querySellerProductBean.setTabType(20);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//同步es时间过长 手动校验
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_027() {
		Logger.start(true, "查询商品,TabType=20，活动商品规格库存为0，活动库存>0，查询成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(3383);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
			ApplyActivityDto activityDto = ProductPriceCallService.ApplyHighActivity("10",productId,beginTime,endTime);
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			ymtCatalogsIWapper.updatestocknumByProductID(0,productId);
			Thread.sleep(3000);
			ProductManagerCallServiceV2.esSync(activityDto.getActivityId(), productId, "ModifyProduct");
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(20);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//同步es时间过长 手动校验
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_028() {
		Logger.start(true, "查询商品,TabType=20，活动商品规格库存为0，活动库存=0，查询失败");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(3383);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
			ApplyActivityDto activityDto = ProductPriceCallService.ApplyHighActivity("10",productId,beginTime,endTime);

			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			ymtCatalogsIWapper.updatestocknumByProductID(0,productId);
			YmtProductActivityStockWapper ymtProductActivityStockWapper = new YmtProductActivityStockWapper();
			ymtProductActivityStockWapper.updateStock0ByProductId(productId);

			Thread.sleep(10000);
			ProductManagerCallServiceV2.esSync(activityDto.getActivityId(), productId, "ModifyProduct");
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(20);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//同步es时间过长 手动校验
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_029() {
		Logger.start(true, "查询商品,TabType=20，活动商品规格库存不为0，活动库存=0，查询成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(3383);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
			Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
			ApplyActivityDto activityDto = ProductPriceCallService.ApplyHighActivity("10",productId,beginTime,endTime);
			YmtProductActivityStockWapper ymtProductActivityStockWapper = new YmtProductActivityStockWapper();
			ymtProductActivityStockWapper.updateStock0ByProductId(productId);
			Thread.sleep(10000);
			ProductManagerCallServiceV2.esSync(activityDto.getActivityId(), productId, "ModifyProduct");
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(20);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//同步es时间过长 手动校验
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_030() {
		Logger.start(true, "查询商品,PackageDeliveryType=1，海外发货，查询成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(3383);
			addpro.getProduct().setPackageDeliveryType(1);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);

			Thread.sleep(2000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setGiftType(-1);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			List<ProductInListDtoBeanV2> productList = querySellerProductListCall.getProductList();
			productList.forEach(p->{
				if (p.getProductId().equals(productId)){
					Logger.verifyEquals(addpro.getProduct().getPackageDeliveryType(),p.getPackageDeliveryType(),"验证PackageDeliveryType");
				}
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	
	
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_035() {
		Logger.start(true, "查询审核中的商品");
		try {
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setSecondCategoryId(1804);
			String ProductId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			Thread.sleep(3000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(9);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
//			Logger.verifyIsContains(ProductId, querySellerProductListCall.getReturnData(), "验证Code");
			JsonArray asJsonArray = querySellerProductListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList");
			asJsonArray.forEach(b->{
				int CheckStatus = b.getAsJsonObject().get("CheckStatus").getAsInt();
				Logger.verifyNotEquals(-1, CheckStatus, "验证CheckStatus不是-1");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_036() {
		Logger.start(true, "查询审核失败的商品");
		try {
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setSecondCategoryId(1804);
			String ProductId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			Thread.sleep(3000);
			
			ProductManagerCallServiceV3.UpdateAuditStatus(ProductId, -1);
			Thread.sleep(3000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(10);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			Logger.verifyIsContains(ProductId, querySellerProductListCall.getReturnData(), "验证Code");
		} catch (Exception e) {
			
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_037() {
		Logger.start(true, "查询物流公司以及时效");
		try {
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setDeliveryCompanyType(1);
			addProdReq.getProduct().setDeliveryAging(5);
			String ProductId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);
			Thread.sleep(3000);
			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(-1);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			ProductInListDtoBeanV2 productInListDtoBeanV2 = querySellerProductListCall.getProductList().get(0);
			Logger.verifyEquals(ProductId, productInListDtoBeanV2.getProductId(), "验证商品id");
			Logger.verifyEquals(1, productInListDtoBeanV2.getDeliveryCompanyType(), "验证物流方式");
			Logger.verifyEquals(5, productInListDtoBeanV2.getDeliveryAging(), "验证物流时效");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_038() {
		Logger.start(true, "newDeliveryAppRelease 为true时，查询老物流商品时候，是新物流类型");
		try {
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(3383);
			querySellerProductBean.setTabType(-1);
			querySellerProductBean.setProductIdList(Arrays.asList("p4493184","p4493185"));
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			ProductInListDtoBeanV2 productInListDtoBeanV2 = querySellerProductListCall.getProductList().get(0);
			Logger.verifyEquals(10, productInListDtoBeanV2.getCatalogStatus(), "验证catalogstatus变成新类型");
			//Logger.verifyEquals("贝海直邮", productInListDtoBeanV2.getCatalogStatusText(), "验证catalogstatus变成新类型");
			Logger.verifyEquals(1, productInListDtoBeanV2.getDeliveryCompanyType(), "验证物流公司");
			Logger.verifyEquals(15, productInListDtoBeanV2.getDeliveryAging(), "验证物流时效");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	///////////////////// 忽略case/////////////////
	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_QuerySellerProductList_034() {
		Logger.start(true, "佣金超过设置的最大值最小值时");
		try {
			sellerId = Integer.parseInt(EnvSetup.getData("globalSellerId"));
			//创建一个商品，获取商品id，设置为优选团商品
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequestV2(sellerId);
			List<CatalogSaveModel> catalogList = addSellerProductRequest.getProduct().getCatalogList();
			String productId = ProductManagerCallServiceV2.addNewProduct(addSellerProductRequest).get("Data").getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(sellerId,productId,1);
			//设置佣金比例、获取规格id、根据规格id，商品id，修改商品佣金
			List<BigDecimal> saleCommissionList = new ArrayList<>();
			saleCommissionList.add(new BigDecimal("0.600"));
			saleCommissionList.add(new BigDecimal("0.700"));
			saleCommissionList.add(new BigDecimal("0.800"));
			saleCommissionList.add(new BigDecimal("0.900"));
			List<String> catalogIds = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(x->x.getsCatalogId()).collect(Collectors.toList());
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(sellerId,productId,catalogIds.get(0),addSellerProductRequest.getSellerName(),saleCommissionList);
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(sellerId,productId,catalogIds.get(1),addSellerProductRequest.getSellerName(),saleCommissionList);
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(sellerId,productId,catalogIds.get(2),addSellerProductRequest.getSellerName(),saleCommissionList);

			
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(addSellerProductRequest.getSellerId());
			querySellerProductBean.setGiftType(1);
			
			ArrayList<String> ProductIdList = new ArrayList<>();
			ProductIdList.add(productId);
			querySellerProductBean.setProductIdList(ProductIdList);
			
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			JsonObject asJsonObject = querySellerProductListCall.getJsonObject().get("Data").getAsJsonObject().getAsJsonArray("ProductList").get(0).getAsJsonObject();
			//最小最大价格
			BigDecimal MinCatalogPrice = asJsonObject.get("MinCatalogPrice").getAsBigDecimal();
			BigDecimal MaxCatalogPrice = asJsonObject.get("MaxCatalogPrice").getAsBigDecimal();
			BigDecimal MinSaleCommission = MinCatalogPrice.multiply(new BigDecimal("0.600"));
			BigDecimal MaxSaleCommission = MaxCatalogPrice.multiply(new BigDecimal("0.900"));
			//最便宜价格*最小佣金比例=最小佣金
			Logger.verifyEquals(MinSaleCommission.setScale(2),asJsonObject.get("MinSaleCommission").getAsBigDecimal().setScale(2),"销售佣金最小值");
			Logger.verifyEquals(MaxSaleCommission.setScale(2),asJsonObject.get("MaxSaleCommission").getAsBigDecimal().setScale(2),"销售佣金最大值");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_QuerySellerProductList_031() {
		Logger.start(true, "查询礼包商品,GiftType=1，查询成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);

			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(globalSellerId);
			querySellerProductBean.setGiftType(1);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			List<ProductInListDtoBeanV2> productList = querySellerProductListCall.getProductList();
			productList.forEach(p->{
				Logger.verifyEquals(1,p.getGiftType(),"验证GiftType");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_QuerySellerProductList_032() {
		Logger.start(true, "查询优选团商品,GiftType=2，查询成功");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(globalSellerId,productId,2);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(globalSellerId);
			querySellerProductBean.setGiftType(2);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			List<ProductInListDtoBeanV2> productList = querySellerProductListCall.getProductList();
			productList.forEach(p->{
				Logger.verifyEquals(2,p.getGiftType(),"验证GiftType");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_QuerySellerProductList_033() {
		Logger.start(true, "查询商品,优选商品设置了标签会员商品");
		try {
			int sellerId1 = Integer.parseInt(EnvSetup.getData("globalSellerId"));
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(sellerId1);
			String productId1 = ProductManagerCallServiceV2.addNewProductOnSale(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV3.SetMemberProduct(productId1, sellerId1, true);
			String productName = addProdReq.getProduct().getProductName();
			ProductManagerCallServiceV2.esSync(0, productId1, "ModifyProduct");
			Thread.sleep(1000);
			QuerySellerProductBean querySellerProductBean = new QuerySellerProductBean();
			querySellerProductBean.setSellerId(sellerId1);
			querySellerProductBean.setProductName(productName);
			querySellerProductListCall.setData(querySellerProductBean);
			querySellerProductListCall.callService();
			Logger.verifyEquals("200", querySellerProductListCall.getString("Code"), "验证Code");
			//验证字段MemberProduct
			boolean bMemberProduct=querySellerProductListCall.getJsonObject().get("Data").getAsJsonObject().get("ProductList").getAsJsonArray().get(0).getAsJsonObject().get("MemberProduct").getAsBoolean();
			Logger.verifyEquals(true, bMemberProduct, "验证bMemberProduct");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	private static Pair<String, String> getOnlyProduct() {
		String productName = "测试商品" + TestDataManager.getRandomNum(10);
		Map<String, Object> updateMap = MapUtil.hashMap("product->productName", productName);
		String productId = ProductFactory.getOnlyProduct(sellerId, sellerName, new ProductFromJSONBean.Builder().UpdateMap(updateMap).JsonBeanFile(jsonBeanFile).build())
				.getProductId();
		return Pair.of(productId, productName);
	}

	private static Pair<String, String> getOnlyProduct(String productName) {
		Map<String, Object> updateMap = MapUtil.hashMap("Product->ProductName", productName);
		String productId = ProductFactory.getOnlyProduct(sellerId, sellerName, new ProductFromJSONBean.Builder().UpdateMap(updateMap).JsonBeanFile(jsonBeanFile).build())
				.getProductId();
		
		return Pair.of(productId, productName);
	}

	public static void checkQuerySellerProductList(int sellerId, QuerySellerProductBean querySellerProductBean, List<String> tgtProductList) throws Exception {
		YMTDateUtil.waitTime(3);
		JSONObject ret = querySellerProductListCall.callAndGetReturnData(querySellerProductBean);

		if (ret.isNull("Data")) {
			Logger.verifyEquals(false, true, "没有查到商品数据");
			return;
		}
		QuerySellerProductListResponseBean actBean = ProductManagerCallService.getBeanFromJson(ret.getJSONObject("Data"), QuerySellerProductListResponseBean.class,
				"yyyy-MM-dd HH:mm:ss");
		for(int i=0;i<actBean.getProductList().size();i++){
			String brandName = actBean.getProductList().get(i).getBrandName().replaceAll("[^a-zA-Z]", "");
			actBean.getProductList().get(i).setBrandName(brandName);
		}
		
		QuerySellerProductListResponseBean tgtBean = ProductManagerCallService.getQuerySellerProductListResponseBean(tgtProductList);

		Logger.verifyEquals(tgtBean.getProductList().size(), actBean.getProductList().size(), "查询结果应与期望值相同");
		AssertHelper.assertResultEqual(tgtBean, actBean, "QuerySellerProductList");

	}

	public static void checkInTab(int sellerId, String productId, QuerySellerProductBean querySellerProductBean, List<TabStatus> isInTabList) throws Exception {
		List<TabStatus> allTabStatus = Arrays.asList(TabStatus.SaleOut, TabStatus.OnSale, TabStatus.OnNotSale, TabStatus.InLive);

		List<TabStatus> notInTabList;

		if (isInTabList != null && isInTabList.size() > 0) {

			for (int i = 0; i < isInTabList.size(); i++) {
				TabStatus ele = isInTabList.get(i);
				Logger.comment("======应该在tab:" + ele + "========");
				querySellerProductBean.setTabType(ele.getCode());
				try {
					checkQuerySellerProductList(sellerId, querySellerProductBean, Arrays.asList(productId));
				} catch (Exception e) {
					e.printStackTrace();
				}
			}

			notInTabList = allTabStatus.stream().filter(x -> !isInTabList.contains(x)).collect(Collectors.toList());
		} else {
			notInTabList = allTabStatus;
		}

		notInTabList.forEach(ele -> {
			Logger.comment("=====不应该在tab:" + ele + "=======");
			querySellerProductBean.setTabType(ele.getCode());
			try {
				Logger.verifyEquals(true, querySellerProductListCall.callAndGetReturnData(querySellerProductBean).getJSONObject("Data").isNull("ProductList"), "不应该在tab:" + ele);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		});
	}

}